<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Order Detail</title>
		<link href="./css/default.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="./js/jsx.js"></script>
		<script type="text/javascript" src="./js/jsml.js"></script>
		<script type="text/javascript" src="./js/ui.js"></script>
		<script type="text/javascript" src="./js/ris.js"></script>
		<script type="text/javascript" src="./js/SR.js"></script>
		<script type="text/javascript" src="./js/preview.js"></script>
		<script type="text/javascript" >
			var imagePath = "./images";
			var errorProvider = new ErrorProvider();
			
			function onBodyLoad()
			{
				if(!Ris)
					return;
					
				var orderDetail = Ris.getHealthcareContext();
				if (orderDetail == null)
				{
					Field.setValue($("myForm"), "");
					return;
				}

				ShowOrder(orderDetail);
			}

			function ShowOrder(orderDetail)
			{
				if (orderDetail)
				{
					Preview.ImagingServiceSection.create($("imagingServiceSection"), orderDetail, { ShowEnterCancelByStaff: true, ShowOrderingPhysicianContactPointDetails: true });
					Preview.OrderedProceduresTable.create($("orderedProceduresSection"), orderDetail.Procedures);

					Preview.ProtocolProceduresTable.create($("protocolProceduresSection"), orderDetail.Procedures, orderDetail.Notes);

					var notes = orderDetail.Notes.select(function(note) { return note.Category == "PrelimDiagnosis"; });
					Preview.OrderNotesTable.create($("prelimDiagnosisNotesSection"), notes, SR.OrderNotes.PreliminaryDiagnosis, false);

					notes = orderDetail.Notes.select(function(note) { return note.Category == "General"; });
					Preview.OrderNotesTable.create($("generalNotesSection"), notes, SR.OrderNotes.OrderNotes, false);

					notes = orderDetail.Notes.select(function(note) { return note.Category == "Protocol"; });
					Preview.OrderNotesTable.create($("protocolNotesSection"), notes, SR.OrderNotes.ProtocolNotes, true);

					Preview.ResultRecipientsSection.create($("resultRecipientsSection"), orderDetail.OrderingPractitioner, orderDetail.ResultRecipients, SR.OrderNotes.CopiesTo);
				}
				else
				{
					Field.show($("orderDetailsSection"), false);
				}
			}
		</script>
	</head>
	<body onload="javascript: onBodyLoad()">
		<form id="myForm">
			<div id="orderDetailsSection">
				<div id="imagingServiceSection"></div>
				<div id="orderedProceduresSection"></div>
				<div id="protocolProceduresSection"></div>
				<div id="prelimDiagnosisNotesSection"></div>
				<div id="generalNotesSection"></div>
				<div id="protocolNotesSection"></div>
				<div id="resultRecipientsSection"></div>
			</div>
		</form>
	</body>
</html>